package com.itheima.mall.controller;

import com.itheima.mall.pojo.OrderSetting;
import com.itheima.mall.service.OmsOrderSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("orderSetting")
public class OmsOrderSettingController {
    @Autowired
    private OmsOrderSettingService omsOrderSettingService;

    /**
     * 修改指定订单设置
     * @param id
     * @param orderSetting
     * @return
     */
    @PostMapping("update/{id}")
    private ResponseEntity update(@PathVariable Long id, @RequestBody OrderSetting orderSetting) {
        int i = omsOrderSettingService.update(id, orderSetting);
        return ResponseEntity.ok(i);
    }
    /**
     * 获取指定订单设置
     * @param id
     * @return
     */
    @GetMapping("{id}")
    private ResponseEntity getById(@PathVariable Long id){
        OrderSetting orderSetting=omsOrderSettingService.getById(id);
        return ResponseEntity.ok(orderSetting);
    }
}
